Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap documentation at 100 characters #5635

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Wrap documentation at 100 characters #5635

merged 1 commit into from
Jul 30, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Jul 30, 2024

Basically sick of dealing with mixed formatting here. Going with the number at

max_line_length = 100

@zanieb zanieb added documentation Improvements or additions to documentation preview Experimental behavior labels Jul 30, 2024
@zanieb
Copy link
Member Author

zanieb commented Jul 30, 2024

Note that I prefer it to be unwrapped and for people to use soft-wrap in their editors because the diff is nonsense when you hard-wrap but 🤷‍♀️ feel like I'm alone in that.

@zanieb
Copy link
Member Author

zanieb commented Jul 30, 2024

I used the VSCode Rewrap plugin for this, I'd love to hear about alternative tooling as that isn't particularly maintained and I don't love that it split inline code.

Base automatically changed from zb/docs-project-concept to main July 30, 2024 22:11
@zanieb zanieb enabled auto-merge (squash) July 30, 2024 22:17
@zanieb zanieb merged commit f971631 into main Jul 30, 2024
46 checks passed
@zanieb zanieb deleted the zb/wrap-docs branch July 30, 2024 22:17
@BurntSushi
Copy link
Member

Note that I prefer it to be unwrapped and for people to use soft-wrap in their editors because the diff is nonsense when you hard-wrap but 🤷‍♀️ feel like I'm alone in that.

Yeah diff quality is one of the downsides of hard-wrap. Back in my days as an academic, when collaborating on a paper, we would always try to insert a line break after a sentence. (Although we still hard-wrapped at 80 columns.) This tended to help with diffs but it's difficult to automate.

Here's a screenshot of what soft-wrap looks like in my editor:

soft-wrap-one-window

And here's what it looks like when I open a second window next to it. The text kinda smushes and runs together with no real smarts about where to insert breaks (vim will just happily insert breaks right in the middle of words):

soft-wrap-two-window

And in particular, one of the very annoying things about soft-wrap, at least in vim, is that it looks like, at a glance, that, for example, "Python does not publish" and "distributions" are on two different lines. And so if your cursor is on "publish," it's easy to be misled that moving down a line should have you land on "distributions." But of course, it doesn't. And so navigating to different parts of the text winds up being really annoying.

And finally, compare the above with what hard-wrap looks like:

hard-wrap

Now the test is a bit easier to read (for me) even when I have one window stretched across the screen because the text is wrapped at a reasonable point. And moving the cursor around is consistent with the appearance. And words aren't split arbitrarily.

This is to some extent a tooling deficiency, but not completely so IMO.

This is also largely why I find long lines of code unwieldy as well.

I used the VSCode Rewrap plugin for this, I'd love to hear about alternative tooling as that isn't particularly maintained and I don't love that it split inline code.

I use par for line wrapping. But I doubt you'd be able to run it on entire Markdown documents and have it produce a desirable result. I guess for that you'd either need a Markdown-aware line wrapper or something that knows how to parse Markdown and only asks the line wrapper to do its work for "paragraph" nodes or whatever.

@konstin
Copy link
Member

konstin commented Aug 1, 2024

Note that I prefer it to be unwrapped and for people to use soft-wrap in their editors because the diff is nonsense when you hard-wrap but 🤷‍♀️ feel like I'm alone in that.

Same, there's so much noise with the reflowing

zanieb added a commit that referenced this pull request Aug 2, 2024
To enforce the 100 character line limit in markdown files introduced in
#5635, and to automate the
formatting of markdown files, i've added prettier and formatted our
markdown files with it.

I've excluded the changelog and the generated references documentation
from this for having too many changes, but we can also include them.

I'm not particular on which style we use. My main motivations are
(major) not having to reflow markdown files myself anymore and (minor)
consistence between all markdown files. I've chosen prettier for similar
reason as we chose black, it's a single good style that's automated and
shared in the community. I do prefer prettier's style of not breaking
inside of a link name though.

This PR is in two parts, the first adds prettier to CI and documents
using it, while the second actually formats the docs. When merge
conflicts arise, we can drop the last commit and regenerate it with `npx
prettier --prose-wrap always --write BENCHMARKS.md CONTRIBUTING.md
README.md STYLE.md docs/*.md docs/concepts/**/*.md docs/guides/**/*.md
docs/pip/**/*.md`.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants